Optimal. Leaf size=53 \[ \frac {2 a \tanh ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{b \sqrt {a^2-b^2}}-\frac {\tanh ^{-1}(\cos (x))}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.11, antiderivative size = 53, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {3789, 3770, 3831, 2660, 618, 206} \[ \frac {2 a \tanh ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{b \sqrt {a^2-b^2}}-\frac {\tanh ^{-1}(\cos (x))}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 618
Rule 2660
Rule 3770
Rule 3789
Rule 3831
Rubi steps
\begin {align*} \int \frac {\csc ^2(x)}{a+b \csc (x)} \, dx &=\frac {\int \csc (x) \, dx}{b}-\frac {a \int \frac {\csc (x)}{a+b \csc (x)} \, dx}{b}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}-\frac {a \int \frac {1}{1+\frac {a \sin (x)}{b}} \, dx}{b^2}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}-\frac {(2 a) \operatorname {Subst}\left (\int \frac {1}{1+\frac {2 a x}{b}+x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )}{b^2}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}+\frac {(4 a) \operatorname {Subst}\left (\int \frac {1}{-4 \left (1-\frac {a^2}{b^2}\right )-x^2} \, dx,x,\frac {2 a}{b}+2 \tan \left (\frac {x}{2}\right )\right )}{b^2}\\ &=-\frac {\tanh ^{-1}(\cos (x))}{b}+\frac {2 a \tanh ^{-1}\left (\frac {b \left (\frac {a}{b}+\tan \left (\frac {x}{2}\right )\right )}{\sqrt {a^2-b^2}}\right )}{b \sqrt {a^2-b^2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.06, size = 62, normalized size = 1.17 \[ \frac {-\frac {2 a \tan ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {b^2-a^2}}\right )}{\sqrt {b^2-a^2}}+\log \left (\sin \left (\frac {x}{2}\right )\right )-\log \left (\cos \left (\frac {x}{2}\right )\right )}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.66, size = 245, normalized size = 4.62 \[ \left [\frac {\sqrt {a^{2} - b^{2}} a \log \left (\frac {{\left (a^{2} - 2 \, b^{2}\right )} \cos \relax (x)^{2} + 2 \, a b \sin \relax (x) + a^{2} + b^{2} + 2 \, {\left (b \cos \relax (x) \sin \relax (x) + a \cos \relax (x)\right )} \sqrt {a^{2} - b^{2}}}{a^{2} \cos \relax (x)^{2} - 2 \, a b \sin \relax (x) - a^{2} - b^{2}}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) + {\left (a^{2} - b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right )}{2 \, {\left (a^{2} b - b^{3}\right )}}, \frac {2 \, \sqrt {-a^{2} + b^{2}} a \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \sin \relax (x) + a\right )}}{{\left (a^{2} - b^{2}\right )} \cos \relax (x)}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) + {\left (a^{2} - b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right )}{2 \, {\left (a^{2} b - b^{3}\right )}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.53, size = 63, normalized size = 1.19 \[ -\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (\frac {1}{2} \, x\right ) + a}{\sqrt {-a^{2} + b^{2}}}\right )\right )} a}{\sqrt {-a^{2} + b^{2}} b} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.22, size = 53, normalized size = 1.00 \[ -\frac {2 a \arctan \left (\frac {2 \tan \left (\frac {x}{2}\right ) b +2 a}{2 \sqrt {-a^{2}+b^{2}}}\right )}{b \sqrt {-a^{2}+b^{2}}}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.43, size = 129, normalized size = 2.43 \[ \frac {\ln \left (\frac {\sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )}\right )}{b}-\frac {2\,a\,\mathrm {atanh}\left (\frac {\sqrt {a^2-b^2}\,\left (4{}\mathrm {i}\,\sin \left (\frac {x}{2}\right )\,a^2+2{}\mathrm {i}\,\cos \left (\frac {x}{2}\right )\,a\,b-1{}\mathrm {i}\,\sin \left (\frac {x}{2}\right )\,b^2\right )}{a^3\,\sin \left (\frac {x}{2}\right )\,4{}\mathrm {i}+b\,\cos \left (\frac {x}{2}\right )\,\left (a^2-b^2\right )\,1{}\mathrm {i}+a^2\,b\,\cos \left (\frac {x}{2}\right )\,1{}\mathrm {i}-a\,b^2\,\sin \left (\frac {x}{2}\right )\,3{}\mathrm {i}}\right )}{b\,\sqrt {a^2-b^2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\csc ^{2}{\relax (x )}}{a + b \csc {\relax (x )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________